<template>
  <transition name="move">
    <div v-show="showFlag" class="Address" ref="addressInfo">
      <v-top :name="title" @close="closePage"></v-top>
      <div class="bottom g-flex-center">
        <div @click="addAddress">
          添加我的地址
        </div>
      </div>
      <v-add ref="add" :showFlag="showAdd"></v-add>
    </div>
  </transition>
</template>

<script>
  import Top from 'components/pageTop/top';
  import Add from './add/add';

  export default {
    name: 'Address',
    data() {
      return {
        title: '我的地址',
        showFlag: false,
        showAdd: false
      };
    },
    created() {
    },
    components: {
      'v-top': Top,
      'v-add': Add
    },
    methods: {
      initShow() {
        this.showFlag = true;
      },
      closePage() {
        if (this.showAdd) {
          this.showAdd = false;
        } else {
          this.showFlag = false;
        }
      },
      addAddress() {
        this.showAdd = true;
      }
    }
  };
</script>

<style scoped>
  .Address {
    position: fixed;
    top: 0;
    left: 0;
    transition: all 0.3s;
    background: #fff;
    width: 100%;
    height: 100%;

  }

  .bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 100px;
    width: 100%;
  }

  .bottom > div {
    background: #ebb563;
    border-radius: 50px;
    padding: 10px 20px;
    color: rgba(0, 0, 0, 0.84);
    font-size: 14px;
  }

  .move-enter-active {
    transform: translate3d(0, 0, 0)
  }

  .move-enter, .move-leave-to {
    transform: translate3d(100%, 0, 0)
  }
</style>
